<?php

namespace Biz\module\Classes\adm;

/**
 * Class ContentSearch
 * @package Biz\module\Classes\adm
 */
class ContentSearch
{
    public $brand_id = null; // 品牌id
    public $keyword = ""; // 搜索词
    public $obj_type = []; // 内容类型 [1 => '图片',2 => '视频',3 => '文章',4 => '整屋案例',]
    public $is_owner = null; // 发布者 品牌商true 住友false
    public $publish_time_range = []; // 发布日期 时间戳
    public $claim_time_range = []; // 收录日期 时间戳
    public $tab = null; // tab类型 1 => 已收录内容(claim_content_status==1) 2 => 精选内容(is_selected==1) 3 => 取消收录内容(claim_content_status==3)
    public $page = 1;
    public $page_size = 20;
    public $claim_content_status = null;
    public $filter_audit_status = []; //排除 AUDIT_STATUS_REJECT = 2; //审核未通过
    public $sort = "claim_time"; //default 默认  addtime 发布时间   claim_time 收录时间(后台使用)  random(随机排序)
    public $desc = "desc"; //asc desc 默认desc
    public $fl = 'id';
    public $claim_type = []; //认领类型
    public $is_top = null; // 1为需要置顶  按照top_time逆向排序
    public $wiki_title = ''; //wiki_title
    public $wiki_id = ''; //wiki_id
    public $brand_ids = []; // 品牌ids
    public $current_time = null; // 当前时间
    public $search_keywords = []; // 检索词
    public $filter_owner_uid = []; //过滤

    public function __construct($params)
    {
        if (!empty($params['fl'])) {
            $this->fl = $params['fl'];
        }
        if (!empty($params['wiki_id'])) {
            $this->wiki_id = $params['wiki_id'];
        }

        if (!empty($params['wiki_title'])) {
            $this->wiki_title = $params['wiki_title'];
        }

        if (!empty($params['claim_type'])) {
            $this->claim_type = $params['claim_type'];
        }

        if (!empty($params['desc'])) {
            $this->desc = $params['desc'];
        }

        if (!empty($params['filter_audit_status'])) {
            $this->filter_audit_status = $params['filter_audit_status'];
        }

        if (!empty($params['sort'])) {
            $this->sort = $params['sort'];
        }

        if (!empty($params['claim_content_status'])) {
            $this->claim_content_status = $params['claim_content_status'];
        }

        if (!empty($params['tab'])) {
            $this->tab = $params['tab'];
        }

        if (!empty($params['brand_id'])) {
            $this->brand_id = $params['brand_id'];
        }

        if (!empty($params['keyword'])) {
            $this->keyword = $params['keyword'];
        }

        if (!empty($params['obj_type'])) {
            $this->obj_type = $params['obj_type'];
        }

        if (isset($params['is_owner'])) {
            $this->is_owner = $params['is_owner'];
        }

        if (isset($params['claim_time_range']['start']) && $params['claim_time_range']['start']) {
            $this->claim_time_range['start'] = $params['claim_time_range']['start'];
        }

        if (isset($params['claim_time_range']['end']) && $params['claim_time_range']['end']) {
            $this->claim_time_range['end'] = $params['claim_time_range']['end'];
        }

        if (isset($params['publish_time_range']['start']) && $params['publish_time_range']['start']) {
            $this->publish_time_range['start'] = $params['publish_time_range']['start'];
        }

        if (isset($params['publish_time_range']['end']) && $params['publish_time_range']['end']) {
            $this->publish_time_range['end'] = $params['publish_time_range']['end'];
        }

        if (isset($params['is_top']) && $params['is_top']) {
            $this->is_top = $params['is_top'];
        }

        if (isset($params['page'])) {
            $this->page = abs($params['page']) ? abs($params['page']) : $this->page;
        }

        if (isset($params['per_page'])) {
            $this->page_size = $params['per_page'];
        }

        if (!empty($params['brand_ids'])) {
            $this->brand_ids = $params['brand_ids'];
        }

        if (!empty($params['current_time'])) {
            $this->current_time = $params['current_time'];
        }

        if (!empty($params['search_keywords'])) {
            $this->search_keywords = $params['search_keywords'];
        }
        if (!empty($params['filter_owner_uid'])) {
            $this->filter_owner_uid = $params['filter_owner_uid'];
        }
    }
}